package cn.itcast.crm.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import cn.itcast.crm.domain.Customer;

public interface CustomerRepository extends JpaRepository<Customer, Integer>{

	public List<Customer> findByFixedAreaIdIsNull();	//怎么实现这个功能的(不用写其他语句)	???

	public List<Customer> findByFixedAreaId(String fixedAreaId);	//怎么实现这个功能的	???
	
	
	@Query("update Customer set fixedAreaId=? where id=?")
	@Modifying
	public void updateFixedArea(String fixedAreaId, Integer id);

	@Query("update Customer set fixedAreaId=null where fixedAreaId=?")
	@Modifying
	public void clearFixedAreaId(String fixedAreaId);
	
}
